package org.tik.mybatis.mapping;

import org.tik.mybatis.session.Configuration;

import java.util.Map;

/**
 * sql信息记录对象，包括记录：SQL类型、SQL语句、入参类型、出参类型等
 *
 * @ClassName: MappedStatement
 * @author: pengwei
 * @data 2022年10月11日 19:36:00
 */
public class MappedStatement {

    private Configuration configuration;
    private String id;
    private SqlCommandType sqlCommandType;
    private BoundSql boundSql;

    public MappedStatement() {

    }

    public static class Builder {
        MappedStatement mappedStatement = new MappedStatement();

        public Builder(Configuration configuration, String msId, SqlCommandType sqlCommandType, BoundSql boundSql) {
            mappedStatement.configuration = configuration;
            mappedStatement.id = msId;
            mappedStatement.sqlCommandType = sqlCommandType;
            mappedStatement.boundSql = boundSql;
        }

        public MappedStatement build() {
            assert mappedStatement.configuration != null;
            assert mappedStatement.id != null;
            return mappedStatement;
        }
    }

    public Configuration getConfiguration() {
        return configuration;
    }

    public String getId() {
        return id;
    }

    public SqlCommandType getSqlCommandType() {
        return sqlCommandType;
    }

    public BoundSql getBoundSql() {
        return boundSql;
    }
}
